-
Notifications
You must be signed in to change notification settings - Fork 311
Align SqlException Numbers across platforms #3461
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/ManagedSni/SniError.netcore.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have existing tests we could update? This is pretty critical functionality.
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/ManagedSni/SniTcpHandle.netcore.cs
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/ManagedSni/SniError.netcore.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/ManagedSni/SniTcpHandle.netcore.cs
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/ManagedSni/SniTcpHandle.netcore.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/ManagedSni/SniError.netcore.cs
Outdated
Show resolved
Hide resolved
Let's resolve the conflicts and promote from draft to normal. |
- Better capture error scenarios in TCP managed SNI. - Fix logging bug in SqlClientEventSource. - Change nativeError from uint to int
f76098c
to
6d0993c
Compare
I rebased to main, fixed the conflicts, and squashed commits. Please re-review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One request.
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/ManagedSni/SniTcpHandle.netcore.cs
Outdated
Show resolved
Hide resolved
Will this be a breaking change? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, seems pretty good!
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/ManagedSni/SniTcpHandle.netcore.cs
Outdated
Show resolved
Hide resolved
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3461 +/- ##
==========================================
- Coverage 68.86% 66.02% -2.84%
==========================================
Files 280 276 -4
Lines 62417 62216 -201
==========================================
- Hits 42982 41079 -1903
- Misses 19435 21137 +1702
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
We don't think so, but I will check the updated code paths to see if anything sticks out. These changes improve surfacing of underlying connection error codes on non-Windows, which boils down to exposing existing specific error codes at the appropriate times. |
src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/ApiShould.cs
Show resolved
Hide resolved
So it will not affect code relying on certain values to be thrown? |
The affected scenarios are all currently surfacing an error number of "0", which is very generic and arguably not actionable. This change should provide actionable error numbers. Linked issues generally refer to this as a "bug" since the underlying errors are actually being hidden. While you could argue that this behavior change is breaking, we've decided to take it for 6.1 since 6.1 will likely be a LTS release and we would be less inclined to make a behavior change in a hotfix. The behavior change will definitely be documented in the release notes. |
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/ManagedSni/SniTcpHandle.netcore.cs
Show resolved
Hide resolved
* - Align SqlException Numbers across platforms - Better capture error scenarios in TCP managed SNI. - Fix logging bug in SqlClientEventSource. - Change nativeError from uint to int * - Removed duplicate SniErrorDetails object and aligned field names. * - Added localized string for the new connection timed out exception. * - Fixed tests sensitive to OS newlines. --------- Co-authored-by: Paul Medynski <31868385+paulmedynski@users.noreply.github.com>
* Reduce automated test crashes (#2968) * Converted Threads to long-running Tasks The key advantage is that exceptions propagate properly. If a thread throws an exception (as a result of a failed test assertion, or otherwise) then the test host crashes and must be restarted. * Corrected the instantiation of the cancellation task - missing state parameter. * Changes to TestSqlCommandCancel, eliminating timing-specific cancellation behaviour testing. This should also allow the test to run on both netcore and netfx. * Responding to code review. * Removed two unnecessary iterations from DatabaseHelper. * Added explanatory comments to ApiShould. * Switched to using Task.WaitAll rather than waiting for each Task in sequence. * Improve cancellation detection Cancellation can trigger one of several different errors, resulting in a flakier test. Also ensure that the query always takes more than 150ms, ensuring that a quick query execution doesn't cause the test to fail. Finally, make sure that we try to read everything from the SqlDataReader. * Correcting previous merge * Align SqlException Numbers across platforms (#3461) * - Align SqlException Numbers across platforms - Better capture error scenarios in TCP managed SNI. - Fix logging bug in SqlClientEventSource. - Change nativeError from uint to int * - Removed duplicate SniErrorDetails object and aligned field names. * - Added localized string for the new connection timed out exception. * - Fixed tests sensitive to OS newlines. --------- Co-authored-by: Paul Medynski <31868385+paulmedynski@users.noreply.github.com> * Align SqlException Numbers across platforms - Manually fixing some error reporting that wasn't cherr-picked because it was part of larger changes. * Updated TdsParser.Windows.cs to use the SniErrorDetails struct from TdsParserStateObject. --------- Co-authored-by: Edward Neal <55035479+edwardneal@users.noreply.github.com> Co-authored-by: David Engel <davidengel@microsoft.com>
Description
Attempt to better align SqlException Numbers across platforms. Wondering if it might be this simple.
Issues
#1773